package com.nbjtjc.safe.api.sys;

import com.nbjtjc.common.validator.ValidatorUtils;
import com.nbjtjc.common.validator.group.DeleteGroup;
import com.nbjtjc.common.validator.group.UpdateGroup;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.SysPostResponsible;
import com.nbjtjc.safe.model.sys.SysPost;
import com.nbjtjc.safe.service.sys.SysPostResponsibleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auther guqianbin
 * @date 2018/9/5 14:56
 * 岗位职责
 **/
@RestController
@RequestMapping("/postResponsible")
@CrossOrigin("*")
public class SysPostResponsibleController {

    @Autowired
    private SysPostResponsibleService sysPostResponsibleService;
    @PostMapping("/add")
    public Result add(SysPostResponsible sysPostResponsible){
        Result result=new Result<>();
        result=sysPostResponsibleService.add(sysPostResponsible);
        return result;
    }

    @PostMapping("/delete")
    public Result delete(SysPostResponsible sysPostResponsible){
        ValidatorUtils.validateEntity(sysPostResponsible, UpdateGroup.class);
        Result result=new Result<>();
        result=sysPostResponsibleService.delete(sysPostResponsible);
        return result;
    }
    @PostMapping("/update")
    public Result update(SysPostResponsible sysPostResponsible){
        ValidatorUtils.validateEntity(sysPostResponsible, UpdateGroup.class);
        Result result=new Result<>();
        result=sysPostResponsibleService.update(sysPostResponsible);
        return result;
    }

    @PostMapping("/find")
    public Result find(SysPostResponsible sysPostResponsible){
        Result result=new Result<>();
        result=sysPostResponsibleService.find(sysPostResponsible);
        return result;
    }
}
